package com.andy.nature.ui.fragment

import android.content.Intent
import com.andy.common.base.BaseVMFragment
import com.andy.common.extend.setOnIMClickListener
import com.andy.nature.databinding.FragmentWidgetBinding
import com.andy.nature.ui.activity.AnimationActivity
import com.andy.nature.ui.activity.BlurActivity
import com.andy.nature.ui.activity.CoordinatorActivity
import com.andy.nature.ui.activity.KeyboardActivity
import com.andy.nature.ui.activity.StickyEffectActivity
import com.andy.nature.ui.activity.UseActivity
import com.andy.nature.vm.WidgetViewModel

/**
 * Author:Andy
 * Date:2023/3/21 14:17
 * Description:FriendsFragment
 */
class WidgetFragment : BaseVMFragment<FragmentWidgetBinding, WidgetViewModel>() {
    override fun viewModelClass(): Class<WidgetViewModel> {
        return WidgetViewModel::class.java
    }

    override fun initObserve() {
    }

    override fun initData() {
    }

    override fun initAction() {
        mBinding?.apply {
            tvTest.setOnIMClickListener {
                startActivity(Intent(requireActivity(), UseActivity::class.java))
            }
            tvKeyboard.setOnIMClickListener {
                startActivity(Intent(requireActivity(), KeyboardActivity::class.java))
            }
            tvBottomDialog.setOnIMClickListener {
                val fragment = MessageFragment.newInstance()
                fragment.show(childFragmentManager, MessageFragment.PAGE_TAG)
            }
            tvHalfBottomDialog.setOnIMClickListener {
                val fragment = HalfMessageFragment.newInstance()
                fragment.show(childFragmentManager, HalfMessageFragment.PAGE_TAG)
            }
            tvCoordinatorLayout.setOnIMClickListener {
                startActivity(Intent(requireActivity(), CoordinatorActivity::class.java))
            }
            tvStickyEffect.setOnIMClickListener {
                startActivity(Intent(requireActivity(), StickyEffectActivity::class.java))
            }
            tvAnimation.setOnIMClickListener {
                startActivity(Intent(requireActivity(), AnimationActivity::class.java))
            }
            tvBlur.setOnIMClickListener {
                startActivity(Intent(requireActivity(), BlurActivity::class.java))
            }
        }
    }

    override fun getViewBinding(): FragmentWidgetBinding {
        return FragmentWidgetBinding.inflate(layoutInflater)
    }
}